package com.huanwei.mini.adapter;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.huanwei.mini.R;
import com.huanwei.mini.base.Base_Z_Adapter;
import com.huanwei.mini.base.MyApplication;
import com.huanwei.mini.http.TZ;


/**
 * Created by juli on 2019/9/2.
 */

public class DemoAdapter extends Base_Z_Adapter {
    String zt;

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        DemoAdapter.Holder holder = null;
        // 查找控件
        if (null == convertView) {
            convertView = LayoutInflater.from(MyApplication.getInstance())
                    .inflate(R.layout.tab_item_1_cx, null);
            holder = new DemoAdapter.Holder();


            holder.imageView = (ImageView) convertView
                    .findViewById(R.id.imageView);
            holder.msg = (TextView) convertView
                    .findViewById(R.id.msg);
            holder.time = (TextView) convertView
                    .findViewById(R.id.time);


            // 缓存Holder
            convertView.setTag(holder);
        } else {
            holder = (DemoAdapter.Holder) convertView.getTag();
        }
        Log.e("7788", mDataList.size() + "a");
        Log.e("7788", position + "b");

        TZ.DataEntity nrowDataeme = (TZ.DataEntity) getItem(position);
        String picurl = nrowDataeme.getPicurl();
        String stime = nrowDataeme.getStime();
        String content = nrowDataeme.getModelname();
        Glide.with(MyApplication.getInstance()).load(picurl) .into(holder.imageView);
        holder.msg.setText(""+content);
        holder.time.setText(""+stime);
        return convertView;
    }


    public class Holder {


        ImageView imageView;
        TextView msg;
        TextView time;

    }


}
